<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!--  -->
    <h1>删除属性</h1>
    <script>
      var obj = {
        bar: 1,
        foo: 2,
        baz: 3,
      }
      obj.bar = undefined
      obj.foo = null
      // delete obj.baz
      for (var i in obj) {
        if (obj.hasOwnProperty(i)) {
          console.log(i, '' + obj[i])
        }
      }
    </script>
  </body>
</html>
